﻿
Public Class Articulos_Compuestos
    Inherits DSEATableAdapters.Articulos_CompuestosTableAdapter

    Public Sub Grabar(ByVal DT As DSEA.Articulos_CompuestosDataTable)
        Me.Update(DT)
    End Sub
End Class

Partial Public Class DSEA
    Partial Class Articulos_CompuestosRow
        Public Sub Carga_Datos_Articulos()
            Try
                Dim TA_Aux As New DSEATableAdapters.ArticulosTableAdapter
                Dim DT_Aux As New DSEA.ArticulosDataTable

                TA_Aux.FillByArticulo(DT_Aux, Me.Componente)

                Me.Consumo = 100
                Me.Venta = DirectCast(DT_Aux.Rows(0), DSEA.ArticulosRow).Precio_Venta_Completa
            Catch ex As Exception

            End Try
        End Sub
    End Class

    Partial Class Articulos_CompuestosDataTable
        Private Sub Articulos_CompuestosDataTable_ColumnChanging(ByVal sender As System.Object, ByVal e As System.Data.DataColumnChangeEventArgs) Handles Me.ColumnChanging
            Dim TA_Aux As New DSEATableAdapters.ArticulosTableAdapter
            Dim DT_Aux As New DSEA.ArticulosDataTable

            If (e.Column.ColumnName = Me.ConsumoColumn.ColumnName) Then
                TA_Aux.FillByArticulo(DT_Aux, DirectCast(e.Row, DSEA.Articulos_CompuestosRow).Componente)

                DirectCast(e.Row, DSEA.Articulos_CompuestosRow).Venta = DirectCast(DT_Aux.Rows(0), DSEA.ArticulosRow).Precio_Venta_Completa * e.ProposedValue / 100
            End If

        End Sub
    End Class
End Class